<template>
    <div>
        <div class="banner" @click="handleBanner">
            <img class="banner-img" :src="bannerImg" alt="">
            <div class="banner-info">
                <div class="banner-title">{{title}}</div>
                <div class="banner-number">
                    <span class="iconfont banner-icon">&#xe692;</span>
                    {{gallaryImg.length}}
                </div>
            </div>
        </div>
        <animation>
            <commonGallary v-show="showGallary" @closeGallary="closeGallary" :gallaryImg='gallaryImg'></commonGallary>
        </animation>
    </div>
</template>

<script>
    import commonGallary from '@/components/common/gallary/gallary'
    import animation from '@/components/common/animation/fade'
    export default {
        props:{
            title:String,
            bannerImg:String,
            gallaryImg:Array
        },
        data() {
            return {
                // 是否显示展示的图片
                showGallary:false,
            }
        },
        methods: {
            handleBanner(){
                this.showGallary=true
            },
            // 接收子组件传过来的关闭展示图的事件
            closeGallary(){
                this.showGallary=false
            }
        },
        components:{
            commonGallary,
            animation
        }
    }
</script>

<style lang="stylus" scoped>
.banner
    position relative
    overflow hidden
    height 0
    padding-bottom 55%
    .banner-img
        width 100%
    .banner-info
        display flex
        position absolute
        left 0
        right 0
        bottom 0
        color #fff
        line-height .6rem
        background-image linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,0.8))
        .banner-title
            flex 1
            font-size .32rem
            padding 0 .2rem
        .banner-number
            padding 0 .4rem
            margin-top .14rem
            height .32rem
            line-height .32rem
            border-radius .2rem
            font-size .32rem
            background rgba(0,0,0,.8)
            .banner-icon
                font-size .32rem
</style>